package com.nijie.library.controller.sys;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.nijie.library.POJO.Message;
import com.nijie.library.POJO.modelPOJO.BorrowInfoPojo;
import com.nijie.library.service.sys.BorrowInfoSvc;

@Controller
@RequestMapping("borrow_info")
public class BorrowInfoCtrl {
	@Autowired
	private BorrowInfoSvc borrowInfoSvc;
	@RequestMapping("borrow_info")
	public String page(){
		return "views/sys/borrowInfo";
	}
	
	/**
	 * 列表
	 * @param title
	 * @return
	 */
	@RequestMapping("getBorrowInfo")
	@ResponseBody
	public List<BorrowInfoPojo> getTitle(BorrowInfoPojo borrowInfoPojo,HttpSession session) {
		borrowInfoPojo.setStatus("1");
		return borrowInfoSvc.get(borrowInfoPojo);
	}
	
	/**
	 * 新增
	 * @param title
	 * @param session
	 * @return
	 */
	@RequestMapping("save")
	@ResponseBody
	public  Message<BorrowInfoPojo> save(BorrowInfoPojo borrowInfoPojo,HttpSession session) {
		Message<BorrowInfoPojo> message = new Message<BorrowInfoPojo>();
		message = borrowInfoSvc.save(borrowInfoPojo);
		return message;
	}
	/**
	 * 更新
	 * @param title
	 * @param session
	 * @return
	 */
	@RequestMapping("modify")
	@ResponseBody
	public  Message<BorrowInfoPojo> modify(BorrowInfoPojo borrowInfoPojo,HttpSession session) {
		Message<BorrowInfoPojo> message = new Message<BorrowInfoPojo>();
		message =borrowInfoSvc.modify(borrowInfoPojo);
		return message;
	}
	/**
	 * 删除
	 * @param ids
	 * @param status
	 * @return
	 */
	@RequestMapping("removeBorrowInfo")
	@ResponseBody
	public  Message<BorrowInfoPojo> removeTitle(String ids, String status,HttpSession session) {
		Message<BorrowInfoPojo> message = new Message<BorrowInfoPojo>();
		message = borrowInfoSvc.modifyStatus(ids, status);
		return message;
	}
	/**
	 * 强制归还书籍
	 * @param ids
	 * @return
	 */
	@RequestMapping("backBook")
	@ResponseBody
	public  Message<BorrowInfoPojo> backBook(String ids) {
		Message<BorrowInfoPojo> message = new Message<BorrowInfoPojo>();
		message = borrowInfoSvc.backBook(ids);
		return message;
	}
}
